package com.huilian.iotbox.admin.service;

import com.alibaba.fastjson.JSONObject;
import com.aliyuncs.exceptions.ClientException;
import com.github.pagehelper.PageInfo;
import com.huilian.iotbox.data.common.ServerResponse;
import com.huilian.iotbox.data.dto.AppFileDto;
import com.huilian.iotbox.data.dto.DeviceDto;
import com.huilian.iotbox.data.dto.RemoteWriteDeivceNoDto;
import com.huilian.iotbox.data.po.Device;
import com.huilian.iotbox.data.po.ExternalDeviceParamValue;
import com.huilian.iotbox.data.vo.DeviceVo;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.security.NoSuchAlgorithmException;
import java.util.List;
import java.util.Set;

/**
 * @author 谢洛涛
 * @date 2021/3/31 12:05
 */
public interface DeviceService {

    List<DeviceVo> findDevice(DeviceDto deviceDto);

    PageInfo findDeviceList(DeviceDto deviceDto);

    ServerResponse unBindingDevice(DeviceDto deviceDto);

    ServerResponse findResidueNewDeviceToDay(DeviceDto deviceDto);

    DeviceVo findDeviceStatistic(DeviceDto deviceDto);


    /**
     * 统计昨天,本月,上月的新增设备数
     *
     * @param deviceDto
     * @return
     */
    DeviceVo findNewDeviceCount(DeviceDto deviceDto);

    /**
     * 统计设备无交易个数
     *
     * @param set
     * @return
     */
    Integer findSetDeviceNoTrade(Integer agencyId, Set<String> set);

    List<DeviceVo> findDistributionDevice(DeviceDto deviceDto);

    ServerResponse distributionDevice(DeviceDto deviceDto);

    ServerResponse updateDeviceById(DeviceDto deviceDto);

    ServerResponse updateUnbindSum(DeviceDto deviceDto);

    ServerResponse sendUpdateBoxConfigById(DeviceDto deviceDto);

    List<Device> findAllDeviceByCondition(DeviceDto deviceDto);

    ServerResponse sendUpdateBoxConfigPulse(DeviceDto deviceDto);

    List<DeviceVo> findAllDeviceByNoHeart(int time);

    /**
     * 查询所有设备数据
     *
     * @return
     */
    List<DeviceVo> findDeviceAll(String heartbeatTime);

    Integer insert(Device device);

    ServerResponse batchRegisterDevice(DeviceDto deviceDto);

    ServerResponse clearDebugConsumeSum(DeviceDto deviceDto);

    ServerResponse clearFreightLane(DeviceDto deviceDto);

    ServerResponse updateMaintainDevice(DeviceDto deviceDto);

    Integer updateDeviceTotalTransactionAmount(DeviceVo deviceVo);

    ServerResponse registerDevice(DeviceDto deviceDto, HttpServletRequest request) throws IOException, NoSuchAlgorithmException, ClientException;

    ServerResponse restoreFactoryDefault(DeviceDto deviceDto);

    DeviceVo findOneDeviceById(DeviceDto deviceDto);

    ServerResponse sendTestCmd(DeviceDto deviceDto);

    ServerResponse registerDeviceByAgencyNo(DeviceDto deviceDto) throws Exception;


    ServerResponse boxParameters(DeviceDto deviceDto);

    ServerResponse queryByCpuIdV2(DeviceDto deviceDto) throws Exception;

    ServerResponse findAppLogDirList(AppFileDto appFileDto);

    ServerResponse noticeDownloadFile(AppFileDto appFileDto);

    ServerResponse uploadAppFile(MultipartFile file) throws IOException;

    ServerResponse remoteWriteDeviceNo(RemoteWriteDeivceNoDto remoteWriteDeivceNoDto);

    ServerResponse batchUpdateStatus(DeviceDto deviceDto);

    ServerResponse getDeviceQrCode(DeviceDto deviceDto);

    ServerResponse queryByCpuIdV3(DeviceDto deviceDto) throws IOException, NoSuchAlgorithmException;

    ServerResponse vendingParameterSettings(DeviceDto deviceDto);

    ServerResponse getDeviceInfoFromBurningSoftware(DeviceDto deviceDto) throws IOException, NoSuchAlgorithmException;

    JSONObject findVendmachByCpuId(DeviceDto deviceDto) throws Exception;

    JSONObject registerDeviceByAgencyNoV2(DeviceDto deviceDto) throws Exception;

    Exception statsDayDeviceJob();

    void boundDeviceOrUnBindOrEditDiscountPackage(DeviceVo deviceVo);

    ServerResponse getConfiguration(DeviceDto deviceDto);
}
